import type { IModalConfig } from '@/components/types'

export const modalConfig: IModalConfig = {
  category: 'crm',
  pageName: 'company',
  header: {
    newTitle: '新建公司',
    editTitle: '编辑公司'
  },
  propItems: [
    {
      type: 'input',
      label: '公司名称',
      prop: 'name',
      placeholder: '请输入公司名称',
      rules: [
        { required: true, message: '请输入公司名称', trigger: 'blur' },
        {
          pattern: /^[\w\u4e00-\u9fa5]{5,25}[公司|集团]$/,
          message: '公司名称不合法，请输入只能包含中文、英文和数字',
          trigger: 'blur'
        }
      ],
      disabled: true
    },
    {
      type: 'input',
      label: '工商号码',
      prop: 'busRegistNo',
      placeholder: '请输入工商号码',
      disabled: true,
      rules: [
        { required: true, message: '请输入工商号码', trigger: 'blur' },
        {
          pattern: /^[0-9a-zA-Z]{15,20}$/,
          message: '工商号码不合法，请输入18位数字或字母',
          trigger: 'blur'
        }
      ]
    },
    {
      type: 'input',
      label: '注册地址',
      prop: 'address',
      placeholder: '请输入注册地址',
      rules: [
        { required: true, message: '请输入注册地址', trigger: 'blur' },
        {
          pattern: /^[\w\u4e00-\u9fa5]{5,50}$/,
          message: '注册地址不合法，请输入5-50位字符',
          trigger: 'blur'
        }
      ]
    },

    {
      type: 'radio',
      label: '状态',
      prop: 'status',
      options: [
        {
          label: '禁用',
          value: false
        },
        {
          label: '启用',
          value: true
        }
      ],
      rules: [
        { required: true, message: '请选择状态', trigger: 'change' },
        {
          type: 'enum',
          enum: [false, true],
          message: '请选择状态',
          trigger: 'change'
        }
      ]
    },
    {
      type: 'input',
      label: '法人代表',
      prop: 'legalPerson',
      placeholder: '请输入法人代表',
      rules: [
        {
          required: true,
          message: '请输入法人代表',
          trigger: 'blur'
        },
        {
          pattern: /^[\w\u4e00-\u9fa5]{2,10}$/,
          message: '法人代表不合法，请输入2-10位字符',
          trigger: 'blur'
        }
      ]
    },
    {
      type: 'input',
      label: '开户银行',
      prop: 'bankName',
      placeholder: '请输入开户银行',
      rules: [
        {
          required: true,
          message: '请输入开户银行',
          trigger: 'blur'
        },
        {
          pattern: /^[\w\u4e00-\u9fa5]{2,25}$/,
          message: '开户银行不合法，请输入2-25位字符',
          trigger: 'blur'
        }
      ]
    },
    {
      type: 'input',
      label: '银行账号',
      prop: 'bankAccount',
      placeholder: '请输入银行账号',
      rules: [
        {
          required: true,
          message: '请输入银行账号',
          trigger: 'blur'
        },
        {
          pattern: /^[\d]{10,30}$/,
          message: '银行账号不合法，请输入10-30位数字',
          trigger: 'blur'
        }
      ]
    },
    {
      type: 'input',
      label: '电话号码',
      prop: 'tel',
      placeholder: '请输入电话号码',
      rules: [
        {
          required: true,
          message: '请输入电话号码',
          trigger: 'blur'
        },
        {
          pattern: /^[\d]{7,15}$/,
          message: '电话号码不合法，请输入7-15位数字',
          trigger: 'blur'
        }
      ]
    },
    {
      type: 'input',
      label: '传真号码',
      prop: 'fax',
      placeholder: '请输入传真号码',
      rules: {
        pattern: /^[\d]{7,15}$/,
        message: '传真号码不合法，请输入7-15位数字',
        trigger: 'blur'
      }
    },
    {
      type: 'input',
      label: '邮政编码',
      prop: 'postal',
      placeholder: '请输入邮政编码',
      rules: {
        pattern: /^[\d]{6}$/,
        message: '邮政编码不合法，请输入6位数字',
        trigger: 'blur'
      }
    },
    {
      type: 'input',
      label: '邮箱号码',
      prop: 'email',
      placeholder: '请输入邮箱号码',
      rules: {
        pattern: /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/,
        message: '邮箱号码不合法，请输入正确的邮箱格式',
        trigger: 'blur'
      }
    },
    {
      type: 'input',
      label: '联系人',
      prop: 'contacts',
      placeholder: '请输入联系人',
      rules: {
        pattern: /^[\w\u4e00-\u9fa5]{2,10}$/,
        message: '联系人不合法，请输入2-10位字符',
        trigger: 'blur'
      }
    },

    {
      type: 'input',
      label: '公司简称',
      prop: 'abbreviation',
      placeholder: '请输入公司简称'
    }
  ]
}
